package registnet.dao;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;


/**
 * This class was autogenerated by Torque on:
 *
 * [Tue Jun 30 14:38:16 PDT 2009]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to CurriculumLog
 */
public abstract class BaseCurriculumLog extends BaseObject
{
    /** The Peer class */
    private static final CurriculumLogPeer peer =
        new CurriculumLogPeer();

        
    /** The value for the curriculumLogId field */
    private int curriculumLogId;
      
    /** The value for the action field */
    private int action;
      
    /** The value for the year field */
    private int year;
      
    /** The value for the month field */
    private int month;
      
    /** The value for the day field */
    private int day;
      
    /** The value for the hour field */
    private int hour;
      
    /** The value for the minute field */
    private String minute;
      
    /** The value for the second field */
    private String second;
      
    /** The value for the curriculumCode field */
    private String curriculumCode;
      
    /** The value for the curriculumName field */
    private String curriculumName;
                                          
    /** The value for the totalUnits field */
    private int totalUnits = 0;
                                          
    /** The value for the aHCount field */
    private int aHCount = 0;
                                          
    /** The value for the mSTCount field */
    private int mSTCount = 0;
                                          
    /** The value for the sSPCount field */
    private int sSPCount = 0;
                                          
    /** The value for the electiveCount field */
    private int electiveCount =  0;
      
    /** The value for the degreeCode field */
    private String degreeCode;
  
    
    /**
     * Get the CurriculumLogId
     *
     * @return int
     */
    public int getCurriculumLogId()
    {
        return curriculumLogId;
    }

                        
    /**
     * Set the value of CurriculumLogId
     *
     * @param v new value
     */
    public void setCurriculumLogId(int v) 
    {
    
                  if (this.curriculumLogId != v)
              {
            this.curriculumLogId = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Action
     *
     * @return int
     */
    public int getAction()
    {
        return action;
    }

                        
    /**
     * Set the value of Action
     *
     * @param v new value
     */
    public void setAction(int v) 
    {
    
                  if (this.action != v)
              {
            this.action = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Year
     *
     * @return int
     */
    public int getYear()
    {
        return year;
    }

                        
    /**
     * Set the value of Year
     *
     * @param v new value
     */
    public void setYear(int v) 
    {
    
                  if (this.year != v)
              {
            this.year = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Month
     *
     * @return int
     */
    public int getMonth()
    {
        return month;
    }

                        
    /**
     * Set the value of Month
     *
     * @param v new value
     */
    public void setMonth(int v) 
    {
    
                  if (this.month != v)
              {
            this.month = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Day
     *
     * @return int
     */
    public int getDay()
    {
        return day;
    }

                        
    /**
     * Set the value of Day
     *
     * @param v new value
     */
    public void setDay(int v) 
    {
    
                  if (this.day != v)
              {
            this.day = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Hour
     *
     * @return int
     */
    public int getHour()
    {
        return hour;
    }

                        
    /**
     * Set the value of Hour
     *
     * @param v new value
     */
    public void setHour(int v) 
    {
    
                  if (this.hour != v)
              {
            this.hour = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Minute
     *
     * @return String
     */
    public String getMinute()
    {
        return minute;
    }

                        
    /**
     * Set the value of Minute
     *
     * @param v new value
     */
    public void setMinute(String v) 
    {
    
                  if (!ObjectUtils.equals(this.minute, v))
              {
            this.minute = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Second
     *
     * @return String
     */
    public String getSecond()
    {
        return second;
    }

                        
    /**
     * Set the value of Second
     *
     * @param v new value
     */
    public void setSecond(String v) 
    {
    
                  if (!ObjectUtils.equals(this.second, v))
              {
            this.second = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the CurriculumCode
     *
     * @return String
     */
    public String getCurriculumCode()
    {
        return curriculumCode;
    }

                        
    /**
     * Set the value of CurriculumCode
     *
     * @param v new value
     */
    public void setCurriculumCode(String v) 
    {
    
                  if (!ObjectUtils.equals(this.curriculumCode, v))
              {
            this.curriculumCode = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the CurriculumName
     *
     * @return String
     */
    public String getCurriculumName()
    {
        return curriculumName;
    }

                        
    /**
     * Set the value of CurriculumName
     *
     * @param v new value
     */
    public void setCurriculumName(String v) 
    {
    
                  if (!ObjectUtils.equals(this.curriculumName, v))
              {
            this.curriculumName = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the TotalUnits
     *
     * @return int
     */
    public int getTotalUnits()
    {
        return totalUnits;
    }

                        
    /**
     * Set the value of TotalUnits
     *
     * @param v new value
     */
    public void setTotalUnits(int v) 
    {
    
                  if (this.totalUnits != v)
              {
            this.totalUnits = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the AHCount
     *
     * @return int
     */
    public int getAHCount()
    {
        return aHCount;
    }

                        
    /**
     * Set the value of AHCount
     *
     * @param v new value
     */
    public void setAHCount(int v) 
    {
    
                  if (this.aHCount != v)
              {
            this.aHCount = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the MSTCount
     *
     * @return int
     */
    public int getMSTCount()
    {
        return mSTCount;
    }

                        
    /**
     * Set the value of MSTCount
     *
     * @param v new value
     */
    public void setMSTCount(int v) 
    {
    
                  if (this.mSTCount != v)
              {
            this.mSTCount = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the SSPCount
     *
     * @return int
     */
    public int getSSPCount()
    {
        return sSPCount;
    }

                        
    /**
     * Set the value of SSPCount
     *
     * @param v new value
     */
    public void setSSPCount(int v) 
    {
    
                  if (this.sSPCount != v)
              {
            this.sSPCount = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the ElectiveCount
     *
     * @return int
     */
    public int getElectiveCount()
    {
        return electiveCount;
    }

                        
    /**
     * Set the value of ElectiveCount
     *
     * @param v new value
     */
    public void setElectiveCount(int v) 
    {
    
                  if (this.electiveCount != v)
              {
            this.electiveCount = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the DegreeCode
     *
     * @return String
     */
    public String getDegreeCode()
    {
        return degreeCode;
    }

                        
    /**
     * Set the value of DegreeCode
     *
     * @param v new value
     */
    public void setDegreeCode(String v) 
    {
    
                  if (!ObjectUtils.equals(this.degreeCode, v))
              {
            this.degreeCode = v;
            setModified(true);
        }
    
          
              }
  
         
                
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
              fieldNames.add("CurriculumLogId");
              fieldNames.add("Action");
              fieldNames.add("Year");
              fieldNames.add("Month");
              fieldNames.add("Day");
              fieldNames.add("Hour");
              fieldNames.add("Minute");
              fieldNames.add("Second");
              fieldNames.add("CurriculumCode");
              fieldNames.add("CurriculumName");
              fieldNames.add("TotalUnits");
              fieldNames.add("AHCount");
              fieldNames.add("MSTCount");
              fieldNames.add("SSPCount");
              fieldNames.add("ElectiveCount");
              fieldNames.add("DegreeCode");
              fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
          if (name.equals("CurriculumLogId"))
        {
                return new Integer(getCurriculumLogId());
            }
          if (name.equals("Action"))
        {
                return new Integer(getAction());
            }
          if (name.equals("Year"))
        {
                return new Integer(getYear());
            }
          if (name.equals("Month"))
        {
                return new Integer(getMonth());
            }
          if (name.equals("Day"))
        {
                return new Integer(getDay());
            }
          if (name.equals("Hour"))
        {
                return new Integer(getHour());
            }
          if (name.equals("Minute"))
        {
                return getMinute();
            }
          if (name.equals("Second"))
        {
                return getSecond();
            }
          if (name.equals("CurriculumCode"))
        {
                return getCurriculumCode();
            }
          if (name.equals("CurriculumName"))
        {
                return getCurriculumName();
            }
          if (name.equals("TotalUnits"))
        {
                return new Integer(getTotalUnits());
            }
          if (name.equals("AHCount"))
        {
                return new Integer(getAHCount());
            }
          if (name.equals("MSTCount"))
        {
                return new Integer(getMSTCount());
            }
          if (name.equals("SSPCount"))
        {
                return new Integer(getSSPCount());
            }
          if (name.equals("ElectiveCount"))
        {
                return new Integer(getElectiveCount());
            }
          if (name.equals("DegreeCode"))
        {
                return getDegreeCode();
            }
          return null;
    }
    
    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
          if (name.equals(CurriculumLogPeer.CURRICULUMLOGID))
        {
                return new Integer(getCurriculumLogId());
            }
          if (name.equals(CurriculumLogPeer.ACTION))
        {
                return new Integer(getAction());
            }
          if (name.equals(CurriculumLogPeer.YEAR))
        {
                return new Integer(getYear());
            }
          if (name.equals(CurriculumLogPeer.MONTH))
        {
                return new Integer(getMonth());
            }
          if (name.equals(CurriculumLogPeer.DAY))
        {
                return new Integer(getDay());
            }
          if (name.equals(CurriculumLogPeer.HOUR))
        {
                return new Integer(getHour());
            }
          if (name.equals(CurriculumLogPeer.MINUTE))
        {
                return getMinute();
            }
          if (name.equals(CurriculumLogPeer.SECOND))
        {
                return getSecond();
            }
          if (name.equals(CurriculumLogPeer.CURRICULUMCODE))
        {
                return getCurriculumCode();
            }
          if (name.equals(CurriculumLogPeer.CURRICULUMNAME))
        {
                return getCurriculumName();
            }
          if (name.equals(CurriculumLogPeer.TOTALUNITS))
        {
                return new Integer(getTotalUnits());
            }
          if (name.equals(CurriculumLogPeer.NUMBERAH))
        {
                return new Integer(getAHCount());
            }
          if (name.equals(CurriculumLogPeer.NUMBERMST))
        {
                return new Integer(getMSTCount());
            }
          if (name.equals(CurriculumLogPeer.NUMBERSSP))
        {
                return new Integer(getSSPCount());
            }
          if (name.equals(CurriculumLogPeer.NUMBERELECTIVE))
        {
                return new Integer(getElectiveCount());
            }
          if (name.equals(CurriculumLogPeer.DEGREECODE))
        {
                return getDegreeCode();
            }
          return null;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
            if (pos == 0)
        {
                return new Integer(getCurriculumLogId());
            }
              if (pos == 1)
        {
                return new Integer(getAction());
            }
              if (pos == 2)
        {
                return new Integer(getYear());
            }
              if (pos == 3)
        {
                return new Integer(getMonth());
            }
              if (pos == 4)
        {
                return new Integer(getDay());
            }
              if (pos == 5)
        {
                return new Integer(getHour());
            }
              if (pos == 6)
        {
                return getMinute();
            }
              if (pos == 7)
        {
                return getSecond();
            }
              if (pos == 8)
        {
                return getCurriculumCode();
            }
              if (pos == 9)
        {
                return getCurriculumName();
            }
              if (pos == 10)
        {
                return new Integer(getTotalUnits());
            }
              if (pos == 11)
        {
                return new Integer(getAHCount());
            }
              if (pos == 12)
        {
                return new Integer(getMSTCount());
            }
              if (pos == 13)
        {
                return new Integer(getSSPCount());
            }
              if (pos == 14)
        {
                return new Integer(getElectiveCount());
            }
              if (pos == 15)
        {
                return getDegreeCode();
            }
              return null;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          save(CurriculumLogPeer.getMapBuilder()
                .getDatabaseMap().getName());
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
      }

      /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
          if (!alreadyInSave)
        {
            alreadyInSave = true;


  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    CurriculumLogPeer.doInsert((CurriculumLog) this, con);
                    setNew(false);
                }
                else
                {
                    CurriculumLogPeer.doUpdate((CurriculumLog) this, con);
                }
            }

                      alreadyInSave = false;
        }
      }


                    
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param  curriculumLogId ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        
    {
            setCurriculumLogId(((NumberKey) key).intValue());
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) 
    {
            setCurriculumLogId(Integer.parseInt(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getCurriculumLogId());
      }

 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
     * related objects to isNew=true.
       */
      public CurriculumLog copy() throws TorqueException
    {
        return copyInto(new CurriculumLog());
    }
  
    protected CurriculumLog copyInto(CurriculumLog copyObj) throws TorqueException
    {
          copyObj.setCurriculumLogId(curriculumLogId);
          copyObj.setAction(action);
          copyObj.setYear(year);
          copyObj.setMonth(month);
          copyObj.setDay(day);
          copyObj.setHour(hour);
          copyObj.setMinute(minute);
          copyObj.setSecond(second);
          copyObj.setCurriculumCode(curriculumCode);
          copyObj.setCurriculumName(curriculumName);
          copyObj.setTotalUnits(totalUnits);
          copyObj.setAHCount(aHCount);
          copyObj.setMSTCount(mSTCount);
          copyObj.setSSPCount(sSPCount);
          copyObj.setElectiveCount(electiveCount);
          copyObj.setDegreeCode(degreeCode);
  
                    copyObj.setCurriculumLogId(0);
                                                                                                      
        
        return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public CurriculumLogPeer getPeer()
    {
        return peer;
    }

    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("CurriculumLog:\n");
        str.append("CurriculumLogId = ")
           .append(getCurriculumLogId())
           .append("\n");
        str.append("Action = ")
           .append(getAction())
           .append("\n");
        str.append("Year = ")
           .append(getYear())
           .append("\n");
        str.append("Month = ")
           .append(getMonth())
           .append("\n");
        str.append("Day = ")
           .append(getDay())
           .append("\n");
        str.append("Hour = ")
           .append(getHour())
           .append("\n");
        str.append("Minute = ")
           .append(getMinute())
           .append("\n");
        str.append("Second = ")
           .append(getSecond())
           .append("\n");
        str.append("CurriculumCode = ")
           .append(getCurriculumCode())
           .append("\n");
        str.append("CurriculumName = ")
           .append(getCurriculumName())
           .append("\n");
        str.append("TotalUnits = ")
           .append(getTotalUnits())
           .append("\n");
        str.append("AHCount = ")
           .append(getAHCount())
           .append("\n");
        str.append("MSTCount = ")
           .append(getMSTCount())
           .append("\n");
        str.append("SSPCount = ")
           .append(getSSPCount())
           .append("\n");
        str.append("ElectiveCount = ")
           .append(getElectiveCount())
           .append("\n");
        str.append("DegreeCode = ")
           .append(getDegreeCode())
           .append("\n");
        return(str.toString());
    }
}
